package threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * ClassName: CachedThreadPool
 * Package: threadpool
 *
 * @Author 马学兴
 * @Create 2024/3/14 14:09
 * @Version 1.0
 * Description:
 */
public class CachedThreadPool {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newCachedThreadPool();
        for (int i = 0; i < 1000; i++) {
            executorService.execute(new Task());

        }

    }

    static class Task implements Runnable{

        @Override
        public void run() {

            System.out.println(Thread.currentThread().getName());
        }
    }
}
